package com.advertise.strutsInterceptor;

import com.advertise.tool.ApplicationHelper;
import com.advertise.tool.GlobalUser;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class LoginInterceptor extends AbstractInterceptor {

	
	public String intercept(ActionInvocation actionInvocation) throws Exception {	
		
		// get the global user and check if null or not, if null that mean no login ,then return login
		// otherwise continue the process
		GlobalUser user = (GlobalUser)ApplicationHelper.getSessionValue("globalUser");		
		
		if(user!=null){			
			return actionInvocation.invoke();
		}
		
		else{		
			return "global_login";
		}
	}

}
